package org.dong.samples.service;

import java.util.List;
import org.dong.samples.dao.UserSubjectHibernateDAO;
import org.dong.samples.model.PagerModel;
import org.dong.samples.model.Subject;
import org.dong.samples.model.User;
import org.dong.samples.model.UserSubject;
import org.dong.samples.model.vo.SubjectVO;
import org.dong.samples.model.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserSubjectHibernateService {
	
	@Autowired
	private UserSubjectHibernateDAO userSubjectHiberanteDAO;
	
	public List<UserSubject> findAllUserSubject() throws Exception{
		return userSubjectHiberanteDAO.findAllUserSubject();
	}
	
	public List<User> findAllUser() throws Exception{
		return userSubjectHiberanteDAO.findAllUser();
	}
	
	public List<Subject> findAllSubject() throws Exception{
		return userSubjectHiberanteDAO.findAllSubject();
	}
	
	public User getUserById(String userId) throws Exception{
		return userSubjectHiberanteDAO.getUserById(userId);
	}
	
	public Subject getSubjectById(Integer subId) throws Exception{
		return userSubjectHiberanteDAO.getSubjectById(subId);
	}
	
	public void createUser(User user) throws Exception{
		userSubjectHiberanteDAO.createUser(user);
	}
	
	public void editUser(User user) throws Exception{
		userSubjectHiberanteDAO.editUser(user);
	}
	
	public void deleteUser(String id) throws Exception{
		userSubjectHiberanteDAO.deleteUser(id);
	}
	
	public void createSubject(Subject subject) throws Exception{
		userSubjectHiberanteDAO.createSubject(subject);
	}
	
	public void editSubject(Subject subject) throws Exception{
		userSubjectHiberanteDAO.editSubject(subject);
	}
	
	public void deleteSubject(Integer subId) throws Exception{
		userSubjectHiberanteDAO.deleteSubject(subId);
	}
	
	public PagerModel<UserVO> pageFindUser() throws Exception{
		return userSubjectHiberanteDAO.pageFindUser();
	}
	
	public PagerModel<SubjectVO> pageFindSubject() throws Exception{
		return userSubjectHiberanteDAO.pageFindSubject();
	}
	
	public void insertTime(String time, String userId){
		userSubjectHiberanteDAO.insertTime(time, userId);
	}
	
	public void insertCount(Integer count, String userId){
		userSubjectHiberanteDAO.insertCount(count, userId);
	}
	
	public void editStatus(Integer subId, Integer status){
		userSubjectHiberanteDAO.editStatus(subId, status);
	}
}
